Skip to content

feat(agent-config): wire exec-broker gates via kit agent-config --broker-gate (Pillar 3 adoption) - #307

Merged
sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a
Jul 10, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Description

First adoption step for the exec-broker (Pillar 3, mechanism delivered in #303–#306): make the PreToolUse gates installable via kit agent-config, not just hand-wireable. installBrokerGates writes both gate-egress and gate-fs into .claude/settings.json.

Type of Change

  • New feature (non-breaking change that adds functionality)

Related Issues

Changes Made

  • src/agent-config.ts — installBrokerGates(cwd): wires PreToolUse gate-egress (matcher Bash) + gate-fs (matcher Write|Edit|NotebookEdit) into .claude/settings.json, idempotently (keyed per gate; a partial re-run adds only the missing one), preserving other hooks/settings. Claude Code only today (the settings schema we know), same staged rollout as the install-gate matrix.
  • src/commands/agent.ts — kit agent-config --broker-gate opt-in flag drives it, with a help line pointing at kit profile sign.
  • src/agent-config.test.ts — 5 tests: both gates wired + idempotent, partial-wire completion, skip when no Claude project.

Testing

Test Coverage

  • Added new tests (5)
  • All tests pass (npm test) — full suite 2712 pass / 0 fail (2709 baseline + 3 net new describe-cases across the agent-config suite)

Manual Testing

  1. npx tsc --noEmit → clean; npx eslint src → 0 errors.
  2. npm run build && node scripts/test.mjs → 2712 pass, 0 fail.
  3. contracts/public-surface.json regenerated → no diff (flag on an existing verb, not a new command).

Breaking Changes

None / N/A — opt-in flag; default kit agent-config behavior is unchanged.

Checklist

  • All new code has test coverage
  • All tests pass locally (npm test)
  • No new warnings or errors introduced
  • No hardcoded secrets or sensitive data
  • Code has been self-reviewed

Performance Impact

  • No performance impact

Reviewer Notes

The opt-in decision is the important one: the install/env gates are default-on because a false-negative there is silent risk, but the broker gates are fail-closed — a wired gate-egress with no verified [scope] denies all network, which would break an agent that hasn't declared a scope yet. So wiring them must be a deliberate act (--broker-gate), taken after kit profile sign, and the help text says so. This is the honest default: don't auto-arm an enforcement that denies everything until the operator has set up what it enforces against. Remaining Pillar 3 adoption: scopeNeeds declarations on individual MCP operations, and extending the gate wiring to the other agents in the matrix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2


Generated by Claude Code

…ker-gate (Pillar 3 adoption)

First adoption step for the exec-broker: make the PreToolUse gates installable, not just
hand-wireable. installBrokerGates(cwd) writes both gate-egress (matcher Bash) and gate-fs
(matcher Write|Edit|NotebookEdit) into .claude/settings.json, idempotently (keyed per gate;
adds only the missing one on a partial re-run), preserving other hooks/settings.

Deliberately OPT-IN via 'kit agent-config --broker-gate' (not default, unlike the install/env
gates): the broker is fail-closed, so a wired egress-gate with no verified [scope] denies ALL
network — only wanted once the operator has declared + signed a scope/RoE (the help line points
at kit profile sign). Claude Code only today (the settings schema we know); other agents follow
when their gate surfaces are mapped, same as the install-gate matrix.

5 tests: both gates wired + idempotent, partial-wire completion (adds only the missing gate),
skip when no Claude project. No public-surface change (flag on an existing verb).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit da1027d into main Jul 10, 2026
18 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a branch July 10, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants